import sys

colors = {'black':    '0;30',     'bright gray':  '0;37',
          'blue':     '0;34',     'white':        '1;37',
          'green':    '0;32',     'bright blue':  '1;34',
          'cyan':     '0;36',     'bright green': '1;32',
          'red':      '0;31',     'bright cyan':  '1;36',
          'purple':   '0;35',     'bright red':   '1;31',
          'yellow':   '0;33',     'bright purple':'1;35',
          'dark gray':'1;30',     'bright yellow':'1;33',
          'normal' : '0'}

class ColorPrint:
    '''Color printing for terminal output.'''
    def __init__(self,colors):
        self.colors = colors

    def __call__(self,text,color):
        if color not in self.colors.keys():
            raise ValueError('%s not recorgnized.' % color)
        else:
            return "\033["+self.colors[color]+"m"+text+"\033[0m" if color != 'normal' else text
